import { SystemSettingDao } from "../../gm_server/dao/SystemSettingDao";
import { RoomModel } from "../../hall_server/model/RoomModel";
import { Logger } from "../engine/utils/Logger";
import { GameConfig } from "./GameConfig";
import { RoomConfig } from "./RoomConfig";

export class RoomJinbiConfig {

    public level: number = 1; //场次
    public difen: number = 0; //底分
    public enterMin: number = 0; //入场最低携带
    public serve: number = 0; //服务费
    public minCharge: number = 0; //最低多少金币
    public online: number = 0; //在线

    private static jinbiConfigList: Array<RoomJinbiConfig> = [
    ]

    private static paodekuai_jinbichangList: Array<RoomJinbiConfig> = [

    ]

    private static ziyouchang_list: Array<RoomJinbiConfig> = [

    ]

    constructor(level: number, difen: number, enterMin: number, serve: number, minCharge: number = 0) {
        this.level = level;
        this.difen = difen
        this.enterMin = enterMin
        this.serve = serve
        this.minCharge = minCharge
    }

    public static async init() {

  

    }


    public static getConfigListByGame(gameType: number) {
        let resultList: Array<RoomJinbiConfig> = []
        for (let i = 0; i < this.jinbiConfigList.length; i++) {
            let config: RoomJinbiConfig = this.jinbiConfigList[i]
            // if (config.gameType == gameType) {
            config.online = RoomModel.getRoomOnlineNumByGameType(RoomConfig.Room_Type.Jinbi, gameType, config.level)
            resultList.push(config)
            // }
        }
        return resultList
    }


    public static getPaodekuaiConfigList() {
        for (let i = 0; i < this.paodekuai_jinbichangList.length; i++) {
            let config: RoomJinbiConfig = this.paodekuai_jinbichangList[i]
            config.online = RoomModel.getRoomOnlineNumByGameType(RoomConfig.Room_Type.Jinbi_Special, GameConfig.Game_Type.paodekuai, config.level)
        }
        return this.paodekuai_jinbichangList
    }


    public static getZiyouchangList() {
        for (let i = 0; i < this.ziyouchang_list.length; i++) {
            let config: RoomJinbiConfig = this.ziyouchang_list[i]
            config.online = RoomModel.getRoomOnlineByRoomType(RoomConfig.Room_Type.Ziyou, config.level)
        }
        return this.ziyouchang_list
    }

    public static getConfigByGameAndLevel(gameType: number, roomType: number, level: number) {
        let configList: Array<RoomJinbiConfig> = []
        if (roomType == RoomConfig.Room_Type.Jinbi) {
            configList = this.jinbiConfigList;
        }
        else if (roomType == RoomConfig.Room_Type.Jinbi_Special) {
            configList = this.paodekuai_jinbichangList;
        }
        else if (roomType == RoomConfig.Room_Type.Ziyou) {
            configList = this.ziyouchang_list;
        }
        for (let i = 0; i < configList.length; i++) {
            let config: RoomJinbiConfig = configList[i]
            if (config.level == level) {
                return config
            }
        }
    }


}